package com.example.demo.service;

import com.example.demo.dto.UserDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class UserService {
    public Long create(UserDTO userDTO){
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        log.info("create init");
        log.info("create success");

        return 1001L;
    }

    public UserDTO getByUid(Long uid){
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        log.info("fetch init");

        UserDTO userDTO = new UserDTO();
        userDTO.setId(uid);
        userDTO.setAge(18);

        return userDTO;
    }

    public Boolean update(UserDTO userDTO){
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        log.info("update init");
        log.info("update success");

        return true;
    }

    public Boolean delete(Long uid){
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        log.info("delete init");
        log.info("delete success");

        return true;
    }

}
